cmake_minimum_required(VERSION 3.16)

project(codenest_client VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt6 6.2 COMPONENTS Quick REQUIRED QuickControls2 Network)

qt_add_executable(appcodenest_client
    main.cpp
)

qt_add_qml_module(appcodenest_client
    URI codenest_client
    VERSION 1.0
    QML_FILES main.qml
    QML_FILES WelcomeComponentOnTheHomepage.qml
    QML_FILES KTabBarView.qml
    QML_FILES WelcomePage.qml
    RESOURCES img.qrc
    QML_FILES KCodeNestTreeView.qml
    SOURCES kcfjsonhandle.h kcfjsonhandle.cpp
    SOURCES kinitializationsettings.h kinitializationsettings.cpp
    SOURCES tool.h tool.cpp
    SOURCES kpublicjsonobjecthandle.h kpublicjsonobjecthandle.cpp
    QML_FILES KChildVersionControlWithVersion.qml
    QML_FILES
    QML_FILES KOperationButton.qml
    QML_FILES KEditPage.qml
    QML_FILES KPopUp.qml
    QML_FILES KAddPage.qml
    QML_FILES KChildRect.qml
    QML_FILES KAnchorScaleComp.qml
    QML_FILES KUserPage.qml
    SOURCES ktcpconnection.h ktcpconnection.cpp
    QML_FILES KUser.qml
    SOURCES ctool.cpp ctool.h
    QML_FILES KUserDtailShowPage.qml
    QML_FILES KFileOpenPage.qml
    # QML_FILES KAnchorScaleComp.qml
)

# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
set_target_properties(appcodenest_client PROPERTIES
#    MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appcodenest_client
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

target_link_libraries(appcodenest_client
    PRIVATE Qt6::Quick Qt6::QuickControls2 Qt6::Network)

include(GNUInstallDirs)
install(TARGETS appcodenest_client
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
